package com.company.day1;
import java.util.Scanner;
// 计算三角形面积
public class AreaTriangle {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        System.out.print("Enter three points for a triangle:");
        double x1 = input.nextDouble(); double y1 = input.nextDouble();
        double x2 = input.nextDouble(); double y2 = input.nextDouble();
        double x3 = input.nextDouble(); double y3 = input.nextDouble();
        double a1 = Math.sqrt(Math.pow(x1-x2,2) + Math.pow(y1-y2,2));
        double a2 = Math.sqrt(Math.pow(x1-x3,2) + Math.pow(y1-y3,2));
        double a3 = Math.sqrt(Math.pow(x2-x3,2) + Math.pow(y2-y3,2));
        double s = (a1 + a2 + a3)/2;
        double area = Math.sqrt(s*(s-a1)*(s-a2)*(s-a3));
        System.out.print("The area of the triangle is " + area);
    }
}
